import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/views/login/index.vue'
import Home from '@/views/home/index.vue'
import NotFound from '@/views/errror/404.vue'
import Register from '@/views/register/index.vue'
import Live from '@/views/home/liveRoom/index.vue'
import User from '@/views/home/role/user.vue'
import Role from '@/views/home/role/role.vue'
import AuthorApply from '@/views/home/authorApply/index.vue'
import ReportRoom from '@/views/home/reportRoom/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/register',
      name: 'register',
      component: Register
    },
    {
      path: '/home',
      name:'home',
      component: Home,
      meta: {
        title: '首页'
      },
      redirect:'home/live',
      children: [
        {
          path: 'live',
          name: 'live',
          component: Live
        },
        {
          path:'user',
          name:'user',
          component:User
        },
        {
          path:'role',
          name:'role',
          component:Role
        },
        {
          path:'author-apply',
          name:'author-apply',
          component:AuthorApply
        },
        {
          path:'report-room',
          name:'report-room',
          component:ReportRoom
        }
      ]
    },
    {
      path: '/:pathMatch(.*)*',
      name: 'NotFound',
      component: NotFound
    },
  ]
})

export default router
